package com.xxgc.spring.service.impl;

import com.xxgc.spring.dao.UserDaoMapper;
import com.xxgc.spring.dao.impl.UserDao;
import com.xxgc.spring.service.IUserLoginService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

//用户登录模块接口实现
public class UserLoginService implements IUserLoginService {
    //和DAO层建立关系（通道）
    private UserDaoMapper udm;
    //构造方法注入
    public UserLoginService(UserDaoMapper udm) {
        this.udm = udm;
    }

    public UserLoginService() {
        System.out.println("我是翠花，我诞生了。");
    }

    public int userLogin(String uName, String uPass) {
        udm.selectUserById();

        if("zs".equals(uName) && "123456".equals(uPass)){
            System.out.println("登录成功");
        }else{
            System.out.println("对不起，您的用户名或密码错误");
            someMsg();
        }
        return 0;
    }

    public int userRegister(String uName, String uPass) {
        System.out.println("用户注册！！！");
        return 0;
    }

    public void someMsg(){
        System.out.println("这是一些话");
    }
}
